using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spinning.Spinning.Entity;
using Microsoft.Xna.Framework;
using Spinning.Spinning.Unitity;

namespace Spinning.Spinning.UI
{
    class StatusBar : BaseEntity
    {
        AnimationSprite logo;
        Sprite speed;
        public Constants.Property Property { get; set; }
        public SpeedBar SpeedBar { get; set; }

        public StatusBar()
        {
            ZIndex = Constants.ui;
            Static = true;
        }

        public override void OnLoad()
        {
            base.OnLoad();

            logo = new AnimationSprite();
            logo.textureName = "StatusBar/logo";
            logo.OnLoad();
            logo.SetAnimation(new Point(2, 2));
            Attach(logo);
            logo.SetChangeFrameAnimation(new int[] { 0 });

            speed = new Sprite();
            speed.textureName = "StatusBar/speed_wbg";
            speed.OnLoad();
            Attach(speed);
            speed.Position = new Vector2(110, 15);

            SpeedBar = new SpeedBar();
            SpeedBar.OnLoad();
            SpeedBar.Position = speed.Position + new Vector2(10, 40);
            Attach(SpeedBar);

           
            //SpeedBar.Full = 2000;
            Property = Constants.Property.Fire;

        }

        protected override void UpdateSelf(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.UpdateSelf(gameTime);
            
            //SpeedBar.Value += 1;

            switch (Property)
            {
                case Constants.Property.Fire:
                    logo.SetChangeFrameAnimation(new int[] { 0 });
                    SpeedBar.speedColor = Color.Red;
                    break;
                case Constants.Property.Water:
                    logo.SetChangeFrameAnimation(new int[] { 1 });
                    SpeedBar.speedColor = Color.Blue;
                    break;
                case Constants.Property.Wind:
                    logo.SetChangeFrameAnimation(new int[] { 2 });
                    SpeedBar.speedColor = new Color(255, 135, 0);
                    break;
            }

        }

    }
}
